<script setup>
import useCounterStore from "@/pinia/stores/counter";
import {storeToRefs} from "pinia";

const counterStore = useCounterStore()
const {counter} = storeToRefs(counterStore)
const change = async () => {
  // counterStore.add()
  // counterStore.addArguments(10)
  try {
    const res = await counterStore.asyncAdd('10')
    console.log(res)
  } catch (e) {
    alert(e.message)
  }
}
</script>

<template>
  <div class="layui-panel">
    <h1>home组件</h1>
    <h3>useCounterStore中state的counter值是：{{ counter }}</h3>
    <button type="button" class="layui-btn layui-btn-normal" @click="change">修改counter</button>
  </div>
</template>

<style scoped lang="less"></style>